package com.jiot.controller.device;

import com.zg.cloud.BaseResponse;
import com.zg.cloud.annotation.TokenCheck;
import com.zg.cloud.service.DeviceTrialDurationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import req.device.AddDeviceTrialDurationReq;
import req.device.DelDeviceTrialDurationReq;
import req.device.ModifyDeviceTrialDurationReq;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author hushi
 * @date 2020/11/5 13:39
 * @description
 */
@RestController
@RequestMapping("/device/trial/duration")
@Api(value = "设备试用时长模块")
public class DeviceTrialDurationController {

    @Resource
    private DeviceTrialDurationService deviceTrialDurationService;

    @PostMapping("/add/device/trial/duration")
    @TokenCheck
    @ApiOperation(value = "添加设备试用时长", notes = "device")
    public BaseResponse addDeviceTrialDuration(@RequestBody @Valid AddDeviceTrialDurationReq addDeviceTrialDurationReq) {
        deviceTrialDurationService.addDeviceTrialDuration(addDeviceTrialDurationReq);
        return new BaseResponse();
    }

    @PostMapping("/modify/device/trial/duration")
    @TokenCheck
    @ApiOperation(value = "修改设备试用时长", notes = "device")
    public BaseResponse modifyDeviceTrialDuration(@RequestBody @Valid ModifyDeviceTrialDurationReq modifyDeviceTrialDurationReq) {
        deviceTrialDurationService.modifyDeviceTrialDuration(modifyDeviceTrialDurationReq);
        return new BaseResponse();
    }

    @PostMapping("/del/device/trial/duration")
    @TokenCheck
    @ApiOperation(value = "删除设备试用时长", notes = "device")
    public BaseResponse delDeviceTrialDuration(@RequestBody @Valid DelDeviceTrialDurationReq delDeviceTrialDurationReq) {
        deviceTrialDurationService.delDeviceTrialDuration(delDeviceTrialDurationReq);
        return new BaseResponse();
    }

}
